package cn.shopifymall.studying.caffeine.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @Author 孤风雪影
 * @Email gitee.com/efairy520
 * @Date 2022/4/7 22:33
 * @Version 1.0
 */
@Slf4j
@RestController
@RequestMapping("/cache")
public class cacheController {

    @Cacheable("print")
    @GetMapping("/print")
    public void printMessage() {
        //测试本地缓存：caffeine，过期时间设置为10s
        log.info("控制台打印信息" + new Date());
    }
}
